package cn.unknownerror.ueteam.gui.frames;

import cn.unknownerror.ueteam.data.ConfigurationManager;
import cn.unknownerror.ueteam.gui.DynamicFrame;
import cn.unknownerror.ueteam.team.ITeam;
import org.bukkit.Bukkit;
import org.bukkit.inventory.Inventory;

import java.util.List;
import java.util.UUID;

public class PlayerListFrame extends DynamicFrame<ITeam> {

    private ConfigurationManager config;

    public PlayerListFrame(ConfigurationManager config){
        super(54,config.getString("GUI。Customize。member_list.title"));
        this.config=config;
    }

    @Override
    public Inventory createInventory(ITeam team) {
        List<UUID> list=team.getMembers();
        for (int i = 0; i < list.size(); i++) {
            setButton(i,new PlayerButton(Bukkit.getOfflinePlayer(list.get(i)),config));
        }
        return super.createInventory(team);
    }
}
